package com.jt.service;

import com.jt.mapper.UserMapper;
import com.jt.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("target")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper mapper;

    @Override
    public void adduser(User user) {
        mapper.adduser(user);
//        try {
//            System.out.println("开启事务");
//            mapper.adduser(user);
//            System.out.println("结束事务");
//
//        }catch (Exception e){
//            e.printStackTrace();
//            System.out.println("回滚");
//        }
    }

    @Override
    public void deleteUser(User user) {
        mapper.deleteUser(user);
    }
}
